package com.michael.retail.commons.pojo.enums;

import lombok.Getter;


public enum OAuth2ClientEnum {

    // new BASE64Encoder().encodeBuffer("michael-admin".getBytes(StandardCharsets.UTF_8));
    // 放入http 头中使用时需要先编码

    TEST("client", "测试客户端"),
    ADMIN("michael-admin", "系统管理端"),
    MINWX("michael-minwx", "微信小程序端");

    @Getter
    private final String clientId;

    @Getter
    private final String desc;

    OAuth2ClientEnum(String clientId, String desc) {
        this.clientId = clientId;
        this.desc = desc;
    }

    public static OAuth2ClientEnum getByClientId(String clientId) {
        for (OAuth2ClientEnum client : OAuth2ClientEnum.values()) {
            if (client.getClientId().equals(clientId)) {
                return client;
            }
        }
        return null;
    }
}
